
#include "PortDrv.h"

void PortDrv_Init(Port_ConfigType *ConfigPtr)
{
    (void*)ConfigPtr;
    PINS_DRV_Init(NUM_OF_CONFIGURED_PINS, g_pin_mux_InitConfigArr);
}

void PortDrv_SetPinDirection(Port_PinType Pin, Port_PinDirectionType Direction)
{
    /************************************************************
     * S32K146_64 pins number
     * PTA: 0~13, total 14
     * PTB: 0~13, total 14
     * PTC: 0~17, total 18
     * PTD: 0~16, total 17
     * PTE: 0~11, total 12
     ***********************************************************/  
    if( PTA_NUMS > Pin )//PTA range, 0~13
    {
        PINS_DRV_SetPinDirection(PTA, (1<<Pin), Direction);
    }
    else if( (PTA_NUMS + PTB_NUMS) > Pin )//PTB range, 14~27
    {
        PINS_DRV_SetPinDirection(PTB, (1<<(Pin-PTA_NUMS)), Direction);
    }
    else if( (PTA_NUMS + PTB_NUMS + PTC_NUMS) > Pin )//PTC range, 28~45
    {
        PINS_DRV_SetPinDirection(PTC, (1<<(Pin-(PTA_NUMS + PTB_NUMS))), Direction);
    }
    else if( (PTA_NUMS + PTB_NUMS + PTC_NUMS + PTD_NUMS) > Pin )//PTD range, 46~62
    {
        PINS_DRV_SetPinDirection(PTD, (1<<(Pin-(PTA_NUMS + PTB_NUMS + PTC_NUMS))), Direction);
    }
    else if( (PTA_NUMS + PTB_NUMS + PTC_NUMS + PTD_NUMS + PTE_NUMS) > Pin )//PTE range, 63~74
    {
        PINS_DRV_SetPinDirection(PTE, (1<<(Pin-(PTA_NUMS + PTB_NUMS + PTC_NUMS + PTD_NUMS))), Direction);
    }
    else
    {
    }
}

void PortDrv_SetPinMode(Port_PinType Pin, Port_PinModeType Mode)
{

}
